package com.htc.android.footprints.commonui;

import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;

import com.google.android.maps.MapView;

public class TBarDrawable extends Drawable
{
  public static Drawable mBoard;
  public static Drawable mSelectedBoard;
  int direct = 1;
  private boolean isTransparent;
  private int jumpHeight;
  private boolean mFocus;
  private Handler mHandler;
  private Drawable mPhoto;
  protected boolean mSelected;

  public TBarDrawable(Drawable paramDrawable, boolean paramBoolean)
  {
    this.mPhoto = paramDrawable;
    setBounds(mBoard.copyBounds());
    Rect localRect = mBoard.copyBounds();
    localRect.left = (7 + localRect.left);
    localRect.right -= 9;
    localRect.top = (7 + localRect.top);
    localRect.bottom -= 28;
    if (this.mPhoto != null)
      this.mPhoto.setBounds(localRect);
    this.isTransparent = paramBoolean;
  }

  public void draw(Canvas paramCanvas)
  {
    paramCanvas.save();
    paramCanvas.translate(0.0F, -this.jumpHeight);
    Rect localRect1 = mBoard.getBounds();
    Rect localRect2 = this.mPhoto.getBounds();
    paramCanvas.save();
    paramCanvas.clipRect(localRect1.left, localRect1.top, localRect1.right, localRect1.bottom);
    if (this.isTransparent)
      paramCanvas.clipRect(localRect2.left, localRect2.top, localRect2.right, localRect2.bottom, Region.Op.DIFFERENCE);
    if (this.mSelected)
      mSelectedBoard.getCurrent().draw(paramCanvas);
    while (true)
    {
      paramCanvas.restore();
      this.mPhoto.draw(paramCanvas);
      paramCanvas.restore();
      return;
      mBoard.getCurrent().draw(paramCanvas);
    }
  }

  public int getOpacity()
  {
    return this.mPhoto.getOpacity();
  }

  public void setAlpha(int paramInt)
  {
    this.mPhoto.setAlpha(paramInt);
    mBoard.setAlpha(paramInt);
  }

  public void setColorFilter(ColorFilter paramColorFilter)
  {
    this.mPhoto.setColorFilter(paramColorFilter);
    mBoard.setColorFilter(paramColorFilter);
    mSelectedBoard.setColorFilter(paramColorFilter);
  }

  public void setFocus(boolean paramBoolean, MapView paramMapView)
  {
    this.mFocus = paramBoolean;
    this.jumpHeight = 0;
    if (paramBoolean)
      if (this.mHandler == null)
      {
        this.mHandler = new Handler(paramMapView)
        {
          public void handleMessage(Message paramMessage)
          {
            if (TBarDrawable.this.jumpHeight > 30)
              TBarDrawable.this.direct = -5;
            while (true)
            {
              TBarDrawable.access$012(TBarDrawable.this, TBarDrawable.this.direct);
              sendEmptyMessageDelayed(0, 100L);
              this.val$mMap.invalidate();
              return;
              if (TBarDrawable.this.jumpHeight > 0)
                continue;
              TBarDrawable.this.direct = 5;
            }
          }
        };
        this.mHandler.sendEmptyMessage(0);
      }
    while (true)
    {
      return;
      if (this.mHandler != null)
      {
        this.mHandler.removeMessages(0);
        this.mHandler = null;
        continue;
      }
    }
  }

  public boolean setState(int[] paramArrayOfInt)
  {
    mBoard.setState(paramArrayOfInt);
    mSelectedBoard.setState(paramArrayOfInt);
    if (this.mPhoto != null)
      this.mPhoto.setState(paramArrayOfInt);
    boolean bool = false;
    int i = paramArrayOfInt.length;
    for (int j = 0; j < i; j++)
    {
      if (16842919 != paramArrayOfInt[j])
        continue;
      bool = true;
    }
    this.mSelected = bool;
    return super.setState(paramArrayOfInt);
  }
}

/* Location:           E:\workspace\dex2java\dex-translator-0.0.9.3\HtcFootprints_dex2jar.jar
 * Qualified Name:     com.htc.android.footprints.commonui.TBarDrawable
 * JD-Core Version:    0.6.0
 */